package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.VisitDto;
import com.zzyl.entity.Visit;
import com.zzyl.vo.VisitVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface VisitMapper {

    int update(Visit visit);

    int deleteById(Long id);

    Visit findById(Long id);

    List<Visit> findAll(@Param("mobile") String mobile, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);


    @Insert("insert into visit(name, mobile, time, visitor, type, status, create_time, update_time, create_by, update_by, remark) VALUES" +
            " (#{name},#{mobile},#{time},#{visitor},#{type},#{status},#{createTime},#{updateTime} ,#{createBy},#{updateBy} ,#{remark})")
    void addVisit(Visit visit);

    // 来访分页查询
    List<VisitVo> pageVisit(LocalDateTime endTime, Integer status, LocalDateTime startTime, String name, String phone, Integer type);


    //List<VisitVo> pageVisit(LocalDateTime endTime, Integer status, LocalDateTime startTime, String name, String phone, Integer type);
}
